Skip to content

Publish SPA2 configuration values as sensors for seplos_bms_v3_ble#238

Merged
syssi merged 1 commit into
mainfrom
feat/spa2-config-sensors
Jun 4, 2026
Merged

Publish SPA2 configuration values as sensors for seplos_bms_v3_ble#238
syssi merged 1 commit into
mainfrom
feat/spa2-config-sensors

Conversation

@syssi

@syssi syssi commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Summary

decode_spa2_data_ parses the second System-Parameters block (0x1335–0x1369, function 0x04) but previously only logged its configuration values. This exposes 8 of them as ESPHome sensors. Register layout per XZH BMS Modbus-RTU Protocol, values verified against the real SPA_DATA_2 capture (SG16S200A-SP57B-A):

Entity Register Factor Unit Value
discharge_overtemperature_protection 0x133A 0.1 K → °C °C 60.0
environment_undertemperature_protection 0x1346 0.1 K → °C °C -10.1
mosfet_overtemperature_protection 0x134A 0.1 K → °C °C 110.0
balancing_start_voltage 0x1350 0.001 V 3.400
balancing_start_difference 0x1351 0.001 V 0.050
low_state_of_charge_alarm 0x1355 0.1 % 5.0
inverter_charge_current_limit 0x1366 1 A 180
inverter_discharge_current_limit 0x1367 abs(int16) A 180

Rated/total capacity (0x1358/0x1359) stay log-only — they are already published via the EIA block.

Changes

  • seplos_bms_v3_ble.h: 8 new sensor members and setters
  • seplos_bms_v3_ble.cpp: publish_state_ calls in decode_spa2_data_ via the existing reg()/temperature() getters; the now-redundant ESP_LOGD lines are dropped
  • sensor.py: 8 new SENSOR_DEFS entries
  • seplos_bms_v3_ble_test.cpp: 4 new tests (temperature thresholds, balancing parameters, capacity/current config, null-sensor safety) against SPA_DATA_2
  • test_component_schemas.py, example YAML updated

Testing

  • pre-commit run --all-files — all hooks pass
  • ./run-cpp-tests.sh seplos_bms_v3_ble seplos_bms_v3_ble_pack — 34/34 pass, incl. the 4 new SPA2 tests

@syssi syssi force-pushed the feat/spa2-config-sensors branch from 2958538 to b4fe72f Compare June 4, 2026 16:56
decode_spa2_data_ (System Parameters, registers 0x1335-0x1369) previously
only logged its configuration values. Expose 8 of them as sensors:
discharge over-temperature, environment under-temperature and MOSFET
over-temperature protection, balancing open voltage/difference, SOC low
alarm, and the inverter charge/discharge current limits.

Rated/total capacity (0x1358/0x1359) stay log-only since they are already
published via EIA. Values are published directly via the existing
reg()/temperature() getters; the now-redundant ESP_LOGD lines are dropped.
Decoding is covered against the existing real SPA_DATA_2 capture.
@syssi syssi force-pushed the feat/spa2-config-sensors branch from b4fe72f to c19ddbc Compare June 4, 2026 17:01
@syssi syssi merged commit 3be0258 into main Jun 4, 2026
16 checks passed
@syssi syssi deleted the feat/spa2-config-sensors branch June 15, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant